/*
 *
 *特征 smoker 吐舌头 击中玩家立刻杀死玩家.
 */
 
#include <sourcemod>
#include <sdktools>
int g_Attacker[MAXPLAYERS+1];


#define PLUGIN_VERSION "1.0"

public Plugin:myinfo =
{
	name = "l4d2_smoker_kill_survivor",
	author = "ヾ藤野深月ゞ",
	description = "smoker 吐舌头 击中玩家立刻杀死玩家",
	version = PLUGIN_VERSION,
	url = "https://gitee.com/sweet-and-sour-bombs/adfvsdsd"
}

public OnPluginStart()
{
	/* Event */
	
	HookEvent("tongue_grab", Even_TongueGrab, EventHookMode_Pre); //舌头吐舌头
}





public Action:Even_TongueGrab(Handle:event, String:event_name[], bool:dontBroadcast)
{
		int victim = GetClientOfUserId(GetEventInt(event, "victim"));
		int attacker = GetClientOfUserId(GetEventInt(event, "userid"));
		if (!victim) return;
		if (!attacker) return;

		g_Attacker[victim] = attacker;
		PrintToChatAll("\x04[提示]\x03Smoker\x05杀死了\x03%s\x05.",  GetTrueName(victim));
		ForcePlayerSuicide(victim);
}



char[] GetTrueName(int client)
{
	char sName[32];
	int Bot = IsClientIdle(client);

	if(Bot != 0)
		FormatEx(sName, sizeof(sName), "闲置:%N", Bot);
	else
		GetClientName(client, sName, sizeof(sName));
	return sName;
}

int IsClientIdle(int client) 
{
	if (!HasEntProp(client, Prop_Send, "m_humanSpectatorUserID"))
		return 0;

	return GetClientOfUserId(GetEntProp(client, Prop_Send, "m_humanSpectatorUserID"));
}





















